package com.example.demo.web;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.example.demo.bean.Article;
import com.example.demo.service.impl.ArticleServiceImpl;

@RestController
@RequestMapping("/article")
public class ArticleController {
	
	//给引用属性赋值
	@Resource
	private ArticleServiceImpl ai;

	
	
	
	@RequestMapping("/save")
	public String add(String title, String status) {
		ai.addArticle( title, status);
		return "插入成功了";
	}
	
	@RequestMapping("/move")
	public String removeArticleC(String title) {
		ai.removeArticle(title);
		return "删除成功了";
	}
	
	
	@RequestMapping("/update")
	public String change(String status, String title) {
		ai.changeArticle(status, title);
		return "更新成功了";
	}
	
	@RequestMapping("/select")
	public List<Article> findAll(){
		return ai.findAll();
	}
	
	
	
}
